package com.xm.xmapp;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.support.v4.view.ViewPager;

import com.xm.xmapp.adapter.ShowImageAdapder;
import com.xm.xmapp.base.BaseActivity;
import com.xm.xmapp.response.bean.CustomImageItem;

public class ShowImageActivity extends BaseActivity {

	private ViewPager pager;
	private ShowImageAdapder adapter;
	private int currentPosition;
	private List<CustomImageItem> mDataList;
	private ArrayList<String> mData;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_zoom);
	}

	@Override
	public void initView() {
		pager = (ViewPager) findViewById(R.id.viewpager);
	}

	@Override
	public void initData() {
		setMyTitle("预览");
		currentPosition = getIntent().getIntExtra("position", 0);
		mDataList = (List<CustomImageItem>) getIntent().getSerializableExtra("list");
		mData = getIntent().getStringArrayListExtra("mData");

		if (mDataList != null) {
			adapter = new ShowImageAdapder(mDataList, this);
		} else {
			adapter = new ShowImageAdapder(mData, this);
		}

		pager.setAdapter(adapter);
		pager.setCurrentItem(currentPosition);
	}

	@Override
	public void initEvent() {

	}

}
